package user

import (
	"github.com/gin-gonic/gin"
	"go-api-template/api/http"
	"go-api-template/api/models/system"
	"go-api-template/service"
)

func (req *SaveReq) Request(ctx *gin.Context, s *service.Service) (resp http.Resp, err error) {

	return req.Do(ctx, s)
}

func (req *ListReq) Request(ctx *gin.Context, s *service.Service) (resp http.Resp, err error) {
	return req.Do(ctx, s)
}

func (req *DeleteReq) Request(ctx *gin.Context, s *service.Service) (resp http.Resp, err error) {
	err = s.Db.Delete(&system.User{}, "id = ?", req.ID).Error
	if err != nil {
		return
	}
	return
}

func (req *OnlineListReq) Request(ctx *gin.Context, s *service.Service) (http.Resp, error) {
	return req.Do(ctx, s)
}

func (req *SetAdminReq) Request(ctx *gin.Context, s *service.Service) (http.Resp, error) {
	return req.Do(ctx, s)
}
